package com.atmilan.quartz.service.impl;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.atmilan.quartz.mapper.StoreProductAttrValueLuxuryMapper;
import com.atmilan.quartz.model.entity.crmeb.StoreProductAttrValue;
import com.atmilan.quartz.service.IStoreProductAttrValueLuxuryService;
import com.baomidou.dynamic.datasource.annotation.DS;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;

/**
* @author Mr.Zhang edit by stivepeim 7-6
* @description StoreProductAttrValueServiceImpl 接口实现
* @date 2020-05-27
*/
@DS("luxury")
@Service
public class StoreProductAttrValueLuxuryServiceImpl extends ServiceImpl<StoreProductAttrValueLuxuryMapper, StoreProductAttrValue> implements IStoreProductAttrValueLuxuryService {
    @Autowired
    StoreProductAttrValueLuxuryMapper storeProductAttrValueLuxuryMapper;

    @Override
    public void deleteAll() {
        storeProductAttrValueLuxuryMapper.deleteAll();
    }

    /**
     * 根据商品id删除AttrValue
     * @param productId 商品id
     * @reture 删除结果
     */
    @Override
    public boolean removeByProductId(Integer productId) {
        LambdaQueryWrapper<StoreProductAttrValue> lambdaQW = new LambdaQueryWrapper<>();
        lambdaQW.eq(StoreProductAttrValue::getProductId, productId);
        return storeProductAttrValueLuxuryMapper.delete(lambdaQW) > 0;
    }
}
